<?php
    include('session.inc');
    require_once('funct.inc');
    include 'color_style.php';
    INCLUDE LANGUAGE;
    
    if(!GetAdminID($ID)){echo LOGIN_ERR;exit;}
    if(!Right_Check(4)){header('Location:error.php');exit;}
    
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <?php echo '<meta http-equiv="Content-Type" content="text/html; charset='._CHARSET_.';">'; ?>

    <?php include 'html_style.php';?>


</head>
<?php

print "<body bgcolor=".Background_Color.">";

require_once('OpenDB.inc');
require_once('functs.inc');
do
{
    if (!OpenDB()){echo OPEN_DB_ERR; break;}


    if($_REQUEST["PageQuanter"]=="")
       $PageNo=$_REQUEST["PageNo"];
    else
       $PageNo=$_REQUEST["PageNo"]-1;

    if($PageNo=="" || $PageNo==-1) $PageNo=0;
 //Definicie tovarov=================================
    $ItemsOnPage = ITEMSONPAGE;
    $ShowQvantumPage = SHOWQVANTUMPAGE;
 //===================================================
    $ActualQvantumPage=$_REQUEST["ActualQvantumPage"];
    if($ActualQvantumPage=="")$ActualQvantumPage = 0;


    $Logged_Admin   =$_SESSION['admin'];
    $index=0;
    $roll_show="/";

    $F_Surname = $_REQUEST["F_Surname"];
    $F_Organisation = $_REQUEST["F_Organisation"];
    $F_ICO = $_REQUEST["F_ICO"];

    $events=$_REQUEST["events"];
    switch($events) {
           case 'delete_user':      {
                                                                             //SQL_Delete_User($_REQUEST["U_ID"]);
                                                                                //break;
                                                                                if ($_REQUEST["GrantDelete"]!="YES")
                                                                             print"
                                                                                     <center>
                                                                                             <table border=\"1\" bgcolor=\"".BACKGROUND_IN_TABLE."\">
                                                                                                     <tr>
                                                                                                             <td>
                                                                                                                     ".U_VYMAZANIE."
                                                                                                                     <center><form action=\"users_management.php\" target=\"place\" method=\"post\">
                                                                                                            <input type=\"hidden\" value=\"".$ActualQvantumPage."\" name=\"ActualQvantumPage\" />
                                                                                                            <input type=\"hidden\" name=\"events\" value=\"delete_user\" />
                                                                                                            <input type=\"hidden\" name=\"U_ID\" value=\"".$_REQUEST["U_ID"]."\" />
                                                                                                            <input type=\"hidden\" name=\"PageNo\" value=\"".$PageNo."\" />
                                                                                                            <input type=\"hidden\" name=\"GrantDelete\" value=\"YES\" />
                                                                                                            <input type=\"hidden\" value=\"".$F_Surname."\" name=\"F_Surname\" />
                                                                                                            <input type=\"hidden\" value=\"".$F_Organisation."\" name=\"F_Organisation\" />
                                                                                                            <input type=\"hidden\" value=\"".$F_ICO."\" name=\"F_ICO\" />
                                                                                                            <input type=\"submit\" value=\"".U_ANO."\" style=\"width :100px; background-color: ".BUTTON_ON_OUT.";\"
                            onmouseover=\"this.style.backgroundColor='".BTN_IN_TABLE."'; this.style.fontWeight='bold';\";
                            onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />
                                                                                                            </form></center><center>
                                                                                                            <form action=\"users_management.php\" target=\"place\" method=\"post\">
                                                                                                            <input type=\"hidden\" value=\"".$ActualQvantumPage."\" name=\"ActualQvantumPage\" />
                                                                                                            <input type=\"hidden\" name=\"events\" value=\"show_userr\" />
                                                                                                            <input type=\"hidden\" name=\"U_ID\" value=\"".$_REQUEST["U_ID"]."\" />
                                                                                                            <input type=\"hidden\" name=\"PageNo\" value=\"".$PageNo."\" />
                                                                                                            <input type=\"hidden\" value=\"".$F_Surname."\" name=\"F_Surname\" />
                                                                                                            <input type=\"hidden\" value=\"".$F_Organisation."\" name=\"F_Organisation\" />
                                                                                                            <input type=\"hidden\" value=\"".$F_ICO."\" name=\"F_ICO\" />
                                                                                                            <input type=\"submit\" value=\"".U_NIE."\" style=\"width :100px; background-color: ".BUTTON_ON_OUT.";\"
                            onmouseover=\"this.style.backgroundColor='".BTN_IN_TABLE."'; this.style.fontWeight='bold';\";
                            onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />
                                                                                                            </form></center>
                                                                                                             </td>
                                                                                                     </tr>
                                                                                             </table>
                                                                                     </center>
                                                                                        ";
                                                                                else
                                                                                    	SQL_Delete_User($_REQUEST["U_ID"]);
                                                                                //************************Top_User*******************************
                                                                                    	if (file_exists("modules/top_user/functions_top.inc")){
																					    	require_once ('modules/top_user/functions_top.inc');
                                                                                     		DeleteTopUser($_REQUEST["U_ID"]);
                                                                                    	}
                                                                                //************************Top_User*******************************
                                                                                break;
                                                                     }
           case 'show_user':        $roll_show = rutine_menu($_REQUEST["roll_show"],$_REQUEST["U_ID"]);
                                    $roll_edit=$_REQUEST["roll_edit"];
                                    break;
           default:break;
    }

    print("<center><b>".U_TITULOK."</b></center>");

    if ($F_Surname=="" and $F_Organisation=="" and $F_ICO=="")
            print"
                    <center>
                    <table style=\"border:1px solid black;\">
                            <tr>
                                    <td>
                                            <form action=\"users_management.php\" target=\"place\" method=\"post\">
                                                    ".U_PRIEZVISKO.":
                                                    <input type=\"text\" name=\"F_Surname\">
                                                    <input type=\"submit\" value=\"".U_VYHLADAJ."\" style=\"width :70px; background-color: ".BUTTON_ON_OUT.";\"
                            onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\";
                            onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />
                                            </form>
                                    </td>
                                    <td>
                                            <form action=\"users_management.php\" target=\"place\" method=\"post\">
                                                    ".U_ORGANIZACIA.":
                                                    <input type=\"text\" name=\"F_Organisation\">
                                                    <input type=\"submit\" value=\"".U_VYHLADAJ."\" style=\"width :70px; background-color: ".BUTTON_ON_OUT.";\"
                            onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\";
                            onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />
                                            </form>
                                    </td>
                                    <td>
                                            <form action=\"users_management.php\" target=\"place\" method=\"post\">
                                                    ".U_ICO.":
                                                    <input type=\"text\" name=\"F_ICO\">
                                                    <input type=\"submit\" value=\"".U_VYHLADAJ."\" style=\"width :70px; background-color: ".BUTTON_ON_OUT.";\"
                            onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\";
                            onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />
                                            </form>
                                    </td>
                            </tr>
                    </table>
                        </center>";
        else
                print"
                    <center>
                    <table style=\"border:1px solid black;\">
                            <tr>
                                    <td>
                                            <form action=\"users_management.php\" target=\"place\" method=\"post\">
                                                    <input type=submit value=\"".U_VZRUSIT_VYHLADANIE."\" style=\"width=280px; background-color: ".BUTTON_ON_OUT.";\"
                            onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\";
                            onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />
                                            </form>
                                    </td>
                            </tr>
                    </table>
                        </center>";


    //**************************************************************************
    //
    //Vytvorenie menu pre vyber zobrazovanej stranky (rozdelenie zobrazovane hotovaru) - ulozene hore
    //
    //**************************************************************************
    if ($F_Surname!="") $sql_psel= "SELECT COUNT(*) FROM users WHERE U_Surname LIKE '%".$F_Surname."%'";
    if ($F_Organisation!="") $sql_psel= "SELECT COUNT(*) FROM users WHERE U_Organisation LIKE '%".$F_Organisation."%'";
    if ($F_ICO!="") $sql_psel= "SELECT COUNT(*) FROM users WHERE U_ICO='".$F_ICO."'";
    if ($F_Surname=="" and $F_Organisation=="" and $F_ICO=="")
                $sql_psel= "SELECT COUNT(*) FROM users";
    $sql_array_adm = mysql_fetch_row(mysql_query($sql_psel));

    if($sql_array_adm[0]/$ItemsOnPage==($PageNo)) $PageNo--;
    if($sql_array_adm[0]/$ItemsOnPage<=$ActualQvantumPage) $ActualQvantumPage=$ActualQvantumPage-$ShowQvantumPage;

    //print $sql_array_adm[0]."<BR>".$PageNo."<BR>".($sql_array_adm[0]/$ItemsOnPage)."<BR>".$ActualQvantumPage;

    if (($sql_array_adm[0])==0){
           print "<br><center><b>".U_SEARCH_ERR."</b></center>";
           break;
      }
    do{
      if (($sql_array_adm[0]/$ItemsOnPage)<=1) break;
      print"<center><table style=\"position:relative;  top:5px;\"><tr>";

// Podmienka prvej >>>> --------------------------------------------------------------------
if(($sql_array_adm[0]/$ItemsOnPage>$ShowQvantumPage) and ($ActualQvantumPage-$ShowQvantumPage>=0)){
             print "<td>";
             print "<form  action=\"users_management.php\" target=\"place\" method=\"post\">";
             if($sql_array_adm[0]>$ShowQvantumPage)
               print "<input type=\"submit\" value=\"<<<\"  style=\"width :50px; background-color: ".BUTTON_ON_OUT.";\"
                             onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\";
                             onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />";
               $xxx=$ActualQvantumPage-$ShowQvantumPage;
               $Pagexxx=$xxx;
               print "<input type=\"hidden\" value=\"".$F_Surname."\" name=\"F_Surname\" />";
               print "<input type=\"hidden\" value=\"".$F_Organisation."\" name=\"F_Organisation\" />";
               print "<input type=\"hidden\" value=\"".$F_ICO."\" name=\"F_ICO\" />";
               print "<input type=\"hidden\" value=\"".$Pagexxx."\" name=\"PageNo\" />";
               print "<input type=\"hidden\" value=\"".$xxx."\" name=\"ActualQvantumPage\" />";
               print "<input type=\"hidden\" value=\"".$Path."\" name=\"path\" />";
               print "<input type=\"hidden\" value=\"".$Category_ID."\" name=\"ID\" />";
             print "</form>";
             print "</td>";
             }
 //--------------------------------------------------------------------------------------

//podmienka zvysnych stranok------------------------------------------------------------
          if(($ActualQvantumPage/$ShowQvantumPage)==floor(($sql_array_adm[0]/$ItemsOnPage)/$ShowQvantumPage))
              { if($sql_array_adm[0]%$ItemsOnPage==0)
                    $ShowActualQvantumPage=((($sql_array_adm[0]/$ItemsOnPage)%$ShowQvantumPage));
                else
                    $ShowActualQvantumPage=((($sql_array_adm[0]/$ItemsOnPage)%$ShowQvantumPage)+1);
              }
          else
              {$ShowActualQvantumPage=$ShowQvantumPage;}
 //---------------------------------------------------------------------------------------

      for($i=$ActualQvantumPage;$i<$ActualQvantumPage+$ShowActualQvantumPage;$i++)
    {
      print "<form  action=\"users_management.php\" target=\"place\" method=\"post\">";
          print "<td>";
          $Xi=$i+1;
          if($PageNo==$i)
            print "<input type=\"submit\" value=\"".$Xi."\" name=\"PageNo\"  style=\"width :50px; background-color: ".BUTTON_ON_OVER.";\" />";
          else
            print "<input type=\"submit\" value=\"".$Xi."\" name=\"PageNo\" style=\"width :25px; background-color: ".BUTTON_ON_OUT.";\"
                            onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\";
                            onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\"
                        />";
          print "<input type=\"hidden\" value=\"".$F_Surname."\" name=\"F_Surname\" />";
          print "<input type=\"hidden\" value=\"".$F_Organisation."\" name=\"F_Organisation\" />";
          print "<input type=\"hidden\" value=\"".$F_ICO."\" name=\"F_ICO\" />";
          print "<input type=\"hidden\" value=\"1\" name=\"PageQuanter\" />";
          print "<input type=\"hidden\" value=\"".$ActualQvantumPage."\" name=\"ActualQvantumPage\" />";
          print "<input type=\"hidden\" value=\"".$Path."\" name=\"path\" />";
          print "<input type=\"hidden\" value=\"".$Category_ID."\" name=\"ID\" />";
          print "</form>";
          print "</td>";
    }

 //podmienka doprednej >>>> -----------------------------------------------------------
if(($sql_array_adm[0]/$ItemsOnPage) > ($ActualQvantumPage+$ShowQvantumPage)){
      print "<td>";
      print "<form  action=\"users_management.php\" target=\"place\" method=\"post\">";
      print "<input type=\"submit\" value=\">>>\"  style=\"width :50px; background-color: ".BUTTON_ON_OUT.";\"
              onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\";
              onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />";
      $xxx=$ActualQvantumPage+$ShowQvantumPage;
      $Pagexxx=$xxx;
      print "<input type=\"hidden\" value=\"".$F_Surname."\" name=\"F_Surname\" />";
      print "<input type=\"hidden\" value=\"".$F_Organisation."\" name=\"F_Organisation\" />";
      print "<input type=\"hidden\" value=\"".$F_ICO."\" name=\"F_ICO\" />";
      print "<input type=\"hidden\" value=\"".$Pagexxx."\" name=\"PageNo\" />";
      print "<input type=\"hidden\" value=\"".$xxx."\" name=\"ActualQvantumPage\" />";
      print "<input type=\"hidden\" value=\"".$Path."\" name=\"path\" />";
      print "<input type=\"hidden\" value=\"".$Category_ID."\" name=\"ID\" />";
    print "</form>";
    print "</td>";
    }
 //--------------------------------------------------------------------------------------
    print "</tr></table></center>";
    PrintLine();
    }while(false);

    print "<br>";
    //**************************************************************************
    //
    //Naplneneie obsahu stranky datami z databazy
    //
    //**************************************************************************
    //if($Category_ID==""){mysql_close(); break;}
        $From   = $PageNo*$ItemsOnPage;
        if ($F_Surname!="") $sql_psel= "SELECT * FROM users WHERE U_Surname LIKE '%".$F_Surname."%' ORDER BY U_Surname LIMIT ".$From.",".$ItemsOnPage;
            if ($F_Organisation!="") $sql_psel= "SELECT * FROM users WHERE U_Organisation LIKE '%".$F_Organisation."%'ORDER BY U_Organisation LIMIT ".$From.",".$ItemsOnPage;
            if ($F_ICO!="") $sql_psel= "SELECT * FROM users WHERE U_ICO='".$F_ICO."'ORDER BY U_Organisation LIMIT ".$From.",".$ItemsOnPage;
               if ($F_Surname=="" and $F_Organisation=="" and $F_ICO=="")
                $sql_psel=  "SELECT * FROM users ORDER BY U_Surname LIMIT ".$From.",".$ItemsOnPage;
        $Product_source = mysql_query($sql_psel);
        $counter=0;
        while($sql_array_adm = mysql_fetch_object($Product_source))
        {
            $ShowAsDetails = is_roll($roll_show,$sql_array_adm->ID);
            if(!$ShowAsDetails)
            {
                    if(($counter%2))
                        print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"98%\" bgcolor=\"".TR_BACKGOUND_COLOR_2."\">";
                    else
                        print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"98%\" bgcolor=\"".TR_BACKGOUND_COLOR_1."\">";

                            //zobrazenie nazvu tovaru
                    print "<tr><td>";
                        if(($counter%2))
                            print "<table  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" bgcolor=\"".TR_BACKGOUND_COLOR_2."\"><tr>";
                        else
                            print "<table  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" bgcolor=\"".TR_BACKGOUND_COLOR_1."\"><tr>";

                    print "<td align=left>";
                      print("<b><font color=\"black\">".$sql_array_adm->U_Surname." ".$sql_array_adm->U_Name."</font color></b>");
                    print "</td>";
                    print "<td align=\"right\">";
                      print("<b><font color=\"".TEXT_COLOR."\">(".$sql_array_adm->U_City.")</font color></b>");
                    print "</td>";
                    print "</tr></table></td>";

                    print "<td align=\"right\" width=\"83px\">";
                          print "<form action=\"users_management.php\" target=\"place\" method=\"post\">";
                            print "<input type=\"hidden\" name=\"events\" value=\"show_user\" />";
                            print "<input type=\"hidden\" name=\"roll_show\" value=\"".$roll_show."\" />";
                            print "<input type=\"hidden\" name=\"U_ID\" value=\"".$sql_array_adm->ID."\" />";
                            print "<input type=\"hidden\" name=\"PageNo\" value=\"".$PageNo."\" />";
                            print "<input type=\"hidden\" value=\"".$F_Surname."\" name=\"F_Surname\" />";
                            print "<input type=\"hidden\" value=\"".$F_Organisation."\" name=\"F_Organisation\" />";
                            print "<input type=\"hidden\" value=\"".$F_ICO."\" name=\"F_ICO\" />";
                            print "<input type=\"hidden\" value=\"".$ActualQvantumPage."\" name=\"ActualQvantumPage\" />";
                            print "<input type=\"submit\" value=\"".U_ZOBRAZIT."\" style=\"width :80px; background-color: ".BUTTON_ON_OUT.";\"
                            onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\";
                            onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />";
                          print "</form>";
                          print "</td>";


                            if (file_exists("modules/discount/discount.inc")){
                                print"
                                    <td align=\"right\" width=\"133px\">
                                        <input type=\"button\" value='".U_OSOBNE_ZLAVY."' style=\"width :130px; border:1px solid black; background-color: ".BUTTON_ON_OUT.";\"
                                            onClick=\"javascript:window.open('modules/discount/discount_menu.php?User_ID=$sql_array_adm->ID','Discount','width=350px,height=600px,location=no,directories=no,menubar=no,resizeable=yes,status=no,toolbar=no,scrollbars=yes');\"
                                            onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\"
                                            onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />
                                    </td>
                                ";
                            }


                        print "<td align=right width=\"63px\">";
                          print "<form action=\"users_management.php\" target=\"place\" method=\"post\">";

                            print "<input type=\"hidden\" name=\"events\" value=\"delete_user\" />";
                            print "<input type=\"hidden\" name=\"roll_show\" value=\"".$roll_show."\" />";
                            print "<input type=\"hidden\" name=\"U_ID\" value=\"".$sql_array_adm->ID."\" />";
                            print "<input type=\"hidden\" name=\"PageNo\" value=\"".$PageNo."\" />";
                            print "<input type=\"hidden\" value=\"".$F_Surname."\" name=\"F_Surname\" />";
                            print "<input type=\"hidden\" value=\"".$F_Organisation."\" name=\"F_Organisation\" />";
                            print "<input type=\"hidden\" value=\"".$F_ICO."\" name=\"F_ICO\" />";
                            print "<input type=\"hidden\" value=\"".$ActualQvantumPage."\" name=\"ActualQvantumPage\" />";
                            print "<input type=\"submit\" value=\"".U_VYMAZ."\" style=\"width :60px; background-color: ".BUTTON_ON_OUT.";\"
                            onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\";
                            onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />";
                          print "</form>";
                          print "</td></tr>";

            }
            else
            {
                if($ShowAsDetails){
                    if(($counter%2))
                        print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"98%\" bgcolor=\"".TR_BACKGOUND_COLOR_2."\">";
                    else
                        print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"98%\" bgcolor=\"".TR_BACKGOUND_COLOR_1."\">";

                    print "<tr><td>";


                    //***********zobrazenie mena, priezviska, nick, prav********
                    if(($counter%2))
                        print "<table  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"".TR_BACKGOUND_COLOR_2."\">";
                    else
                        print "<table  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"".TR_BACKGOUND_COLOR_1."\">";

                                        print"<tr>
                                                        <td>
                                                                ".U_ORGANIZACIA.":
                                                        </td>
                                                        <td>
                                                                <b>".$sql_array_adm->U_Organisation."</b>
                                                        </td>
                                                </tr>
                                                <tr>
                                                        <td>
                                                                ".U_MENO.":
                                                        </td>
                                                        <td>
                                                                <b>".$sql_array_adm->U_Name."</b>
                                                        </td>
                                                </tr>
                                                <tr>
                                                        <td>
                                                                ".U_PRIEZVISKO.":
                                                        </td>
                                                        <td>
                                                                <b>".$sql_array_adm->U_Surname."</b>
                                                        </td>
                                                </tr>
                                                <tr>
                                                        <td>
                                                                ".U_MESTO.":
                                                        </td>
                                                        <td>
                                                                <b>".$sql_array_adm->U_City."</b>
                                                        </td>
                                                </tr>
                                                <tr>
                                                        <td>
                                                                ".U_ULICA.":
                                                        </td>
                                                        <td>
                                                                <b>".$sql_array_adm->U_Street."</b>
                                                        </td>
                                                </tr>
                                                <tr>
                                                        <td>
                                                                ".U_PSC.":
                                                        </td>
                                                        <td>
                                                                <b>".$sql_array_adm->U_PostID."</b>
                                                        </td>
                                                </tr>
                                                <tr>
                                                        <td>
                                                                ".U_MOBIL.":
                                                        </td>
                                                        <td>
                                                                <b>".$sql_array_adm->U_Mobile."</b>
                                                        </td>
                                                </tr>
                                                <tr>
                                                        <td>
                                                                ".U_TEL.":
                                                        </td>
                                                        <td>
                                                                <b>".$sql_array_adm->U_Phone."</b>
                                                        </td>
                                                </tr>
                                                <tr>
                                                        <td>
                                                                ".U_MAIL.":
                                                        </td>
                                                        <td>
                                                                <A HREF=\"mailto:".$sql_array_adm->U_Email."\">".$sql_array_adm->U_Email."</A>
                                                        </td>
                                                </tr>
                                                <tr>
                                                        <td>
                                                                ".U_DAT_NAROD.":
                                                        </td>
                                                        <td>
                                                                <b>".$sql_array_adm->U_BirthDate."</b>
                                                        </td>
                                                </tr>
                                                <tr>
                                                        <td>
                                                                ".U_ICO.":
                                                        </td>
                                                        <td>
                                                                <b>".$sql_array_adm->U_ICO."</b>
                                                        </td>
                                                </tr>
                                                <tr>
                                                        <td>
                                                                ".U_DIC.":
                                                        </td>
                                                        <td>
                                                                <b>".$sql_array_adm->U_DIC."</b>
                                                        </td>
                                                </tr>";//koniec print
if (file_exists("modules/discount/discount.inc"))
													{
										            print"<tr>
										                    <td>
										                            <br>
										                            <input type=\"button\" value='".U_OSOBNE_ZLAVY."' style=\"width :150px; border:1px solid black; background-color: ".BUTTON_ON_OUT.";\"
																				onClick=\"javascript:window.open('modules/discount/discount_menu.php?User_ID=$sql_array_adm->ID','Discount','width=350px,height=600px,location=no,directories=no,menubar=no,resizeable=yes,status=no,toolbar=no,scrollbars=yes');\" 
													                            onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\"
													                            onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />
										                    		</td>
										            </tr>";//koniec print
        											}


                    print "</table>";
                    //**********************************************************

                    print "</td><tr>";

                    print "<tr><td>";
                    print "<td align=\"right\" valign=\"bottom\" width=\"83px\">";
                          print "<form action=\"users_management.php\" target=\"place\" method=\"post\">";
                            print "<input type=\"hidden\" name=\"events\" value=\"show_user\" />";
                            print "<input type=\"hidden\" name=\"roll_show\" value=\"".$roll_show."\" />";
                            print "<input type=\"hidden\" name=\"U_ID\" value=\"".$sql_array_adm->ID."\" />";
                            print "<input type=\"hidden\" name=\"PageNo\" value=\"".$PageNo."\" />";
                            print "<input type=\"hidden\" value=\"".$F_Surname."\" name=\"F_Surname\" />";
                            print "<input type=\"hidden\" value=\"".$F_Organisation."\" name=\"F_Organisation\" />";
                            print "<input type=\"hidden\" value=\"".$F_ICO."\" name=\"F_ICO\" />";
                            print "<input type=\"hidden\" value=\"".$ActualQvantumPage."\" name=\"ActualQvantumPage\" />";
                            print "<input type=\"submit\" value=\"".U_ZRUS_NAHLAD."\" style=\"width :120px; background-color: ".BUTTON_ON_OUT.";\"
                            onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\";
                            onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />";
                          print "</form>";
                    print "</td></tr>";

                    print "</table>";
                };
            }
            print "</table>";
            $counter++;
        }


        print "<br>";
        PrintLine();

    //**************************************************************************
    //
    //Vytvorenie menu pre vyber zobrazovanej stranky (rozdelenie zobrazovane hotovaru) - ulozene dole
    //
    //**************************************************************************
    if ($F_Surname!="") $sql_psel= "SELECT COUNT(*) FROM users WHERE U_Surname LIKE '%".$F_Surname."%'";
    if ($F_Organisation!="") $sql_psel= "SELECT COUNT(*) FROM users WHERE U_Organisation LIKE '%".$F_Organisation."%'";
    if ($F_ICO!="") $sql_psel= "SELECT COUNT(*) FROM users WHERE U_ICO='".$F_ICO."'";
    if ($F_Surname=="" and $F_Organisation=="" and $F_ICO=="")
                $sql_psel= "SELECT COUNT(*) FROM users";

    $sql_array_adm = mysql_fetch_row(mysql_query($sql_psel));
    do{
              if (($sql_array_adm[0]/$ItemsOnPage)<=1) break;
              print"<CENTER><table style=\"position:relative;  top:5px;\"><tr>";

// Podmienka prvej >>>> --------------------------------------------------------------------
      if(($sql_array_adm[0]/$ItemsOnPage>$ShowQvantumPage) and ($ActualQvantumPage-$ShowQvantumPage>=0)){
             print "<td>";
             print "<form  action=\"users_management.php\" target=\"place\" method=\"post\">";
             if($sql_array_adm[0]>$ShowQvantumPage)
               print "<input type=\"submit\" value=\"<<<\"  style=\"width :50px; background-color: ".BUTTON_ON_OUT.";\"
                             onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\";
                             onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />";
               $xxx=$ActualQvantumPage-$ShowQvantumPage;
               $Pagexxx=$xxx;
               print "<input type=\"hidden\" value=\"".$F_Surname."\" name=\"F_Surname\" />";
               print "<input type=\"hidden\" value=\"".$F_Organisation."\" name=\"F_Organisation\" />";
               print "<input type=\"hidden\" value=\"".$F_ICO."\" name=\"F_ICO\" />";
               print "<input type=\"hidden\" value=\"".$Pagexxx."\" name=\"PageNo\" />";
               print "<input type=\"hidden\" value=\"".$xxx."\" name=\"ActualQvantumPage\" />";
               print "<input type=\"hidden\" value=\"".$Path."\" name=\"path\" />";
               print "<input type=\"hidden\" value=\"".$Category_ID."\" name=\"ID\" />";
             print "</form>";
             print "</td>";
             }
 //--------------------------------------------------------------------------------------

//podmienka zvysnych stranok------------------------------------------------------------
          if(($ActualQvantumPage/$ShowQvantumPage)==floor(($sql_array_adm[0]/$ItemsOnPage)/$ShowQvantumPage))
              { if($sql_array_adm[0]%$ItemsOnPage==0)
                    $ShowActualQvantumPage=((($sql_array_adm[0]/$ItemsOnPage)%$ShowQvantumPage));
                else
                    $ShowActualQvantumPage=((($sql_array_adm[0]/$ItemsOnPage)%$ShowQvantumPage)+1);
              }
          else
              {$ShowActualQvantumPage=$ShowQvantumPage;}
 //---------------------------------------------------------------------------------------
      for($i=$ActualQvantumPage;$i<$ActualQvantumPage+$ShowActualQvantumPage;$i++)
    {
      print "<form  action=\"users_management.php\" target=\"place\" method=\"post\">";
          print "<td>";
          $Xi=$i+1;
          if($PageNo==$i)
            print "<input type=\"submit\" value=\"".$Xi."\" name=\"PageNo\"  style=\"width :50px; background-color: ".BUTTON_ON_OVER.";\">";
          else
            print "<input type=\"submit\" value=\"".$Xi."\" name=\"PageNo\" style=\"width :25px; background-color: ".BUTTON_ON_OUT.";\"
                            onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\";
                            onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\"
                        />";
          print "<input type=\"hidden\" value=\"".$F_Surname."\" name=\"F_Surname\" />";
          print "<input type=\"hidden\" value=\"".$F_Organisation."\" name=\"F_Organisation\" />";
          print "<input type=\"hidden\" value=\"".$F_ICO."\" name=\"F_ICO\" />";
          print "<input type=\"hidden\" value=\"1\" name=\"PageQuanter\" />";
          print "<input type=\"hidden\" value=\"".$ActualQvantumPage."\" name=\"ActualQvantumPage\" />";
          print "<input type=\"hidden\" value=\"".$Path."\" name=\"path\" />";
          print "<input type=\"hidden\" value=\"".$Category_ID."\" name=\"ID\" />";
          print "</form>";
          print "</td>";
    }

 //podmienka doprednej >>>> -----------------------------------------------------------
if(($sql_array_adm[0]/$ItemsOnPage) > ($ActualQvantumPage+$ShowQvantumPage)){
      print "<td>";
      print "<form  action=\"users_management.php\" target=\"place\" method=\"post\">";
      print "<input type=\"submit\" value=\">>>\"  style=\"width :50px; background-color: ".BUTTON_ON_OUT.";\"
              onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\";
              onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\">";
      $xxx=$ActualQvantumPage+$ShowQvantumPage;
      $Pagexxx=$xxx;
      print "<input type=\"hidden\" value=\"".$F_Surname."\" name=\"F_Surname\" />";
      print "<input type=\"hidden\" value=\"".$F_Organisation."\" name=\"F_Organisation\" />";
      print "<input type=\"hidden\" value=\"".$F_ICO."\" name=\"F_ICO\" />";
      print "<input type=\"hidden\" value=\"".$Pagexxx."\" name=\"PageNo\" />";
      print "<input type=\"hidden\" value=\"".$xxx."\" name=\"ActualQvantumPage\" />";
      print "<input type=\"hidden\" value=\"".$Path."\" name=\"path\" />";
      print "<input type=\"hidden\" value=\"".$Category_ID."\" name=\"ID\" />";
    print "</form>";
    print "</td>";
    }
 //--------------------------------------------------------------------------------------
    print "</tr></table></center>";
    PrintLine();
    }while(false);




        mysql_close();
}
while(false)
?>


</body>
</html>
